<?php
header("Content-Type:application/json;charset=utf-8");
header('Access-Control-Allow-Origin:*');
if(isset($_GET["uname"])){
    //1.接收到浏览器往服务器传递的参数
    $UNAME=$_GET["uname"];
    //2.创建数据库的链接对象
    $host="127.0.0.1";
    $name="root";
    $pwd="";
    $db="mia";
    $port="3306";
    $conn=new mysqli($host,$name,$pwd,$db,$port);
    //3.设置链接的字符集
    mysqli_query($conn,"set names utf8");
    //4.准备sql语句
    $sql="SELECT * FROM userinfo WHERE uname='".$UNAME."'";
    //5.执行sql语句
    $result=$conn->query($sql);
    //6.判断结果
    if($result->num_rows>=1){
        print_r("false");
    }else{
        print_r("true");
    }
    //7.关闭链接
    $conn->close();
}